
/**
 * HittableList
 * @version 1.0
 * @since 1.0
 * <p>
 * Created by Murphy at 2021/7/9 16:44
 **/

#pragma once

#include "math/Ray.hpp"
#include "Hittable.hpp"

#include <memory>
#include <utility>
#include <vector>

using std::shared_ptr;
using std::make_shared;
using std::vector;

namespace Stitches
{

class HittableList : public Hittable
{
public:

    HittableList() {}

    HittableList(shared_ptr<Hittable> object) { add(std::move(object)); }

    void clear() { objects.clear(); }

    void add(shared_ptr<Hittable> object) { objects.push_back(object); }


    virtual bool hit(const Ray &r, double tmin, double tmax, HitRecord &rec) const override;

private:
    vector<shared_ptr<Hittable>> objects;
};

}
